//
//  ModelCollectionViewCell.m
//  UI19_豆瓣UICollectionView
//
//  Created by apple on 16/1/29.
//  Copyright © 2016年 King. All rights reserved.
//

#import "ModelCollectionViewCell.h"

#import "UIImageView+WebCache.h"

@implementation ModelCollectionViewCell


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        self.imageViewModel = [[UIImageView alloc] initWithFrame:CGRectZero];
        [self.contentView addSubview:self.imageViewModel];
        
        self.titleLable = [[UILabel alloc] initWithFrame:CGRectZero];
        self.titleLable.textAlignment = NSTextAlignmentCenter;
        self.titleLable.font = [UIFont systemFontOfSize:15];
        self.titleLable.lineBreakMode = NSLineBreakByTruncatingMiddle;
        [self.contentView addSubview:self.titleLable];
        
    }
    return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    self.imageViewModel.frame = CGRectMake(10, 0, self.contentView.frame.size.width - 20, self.contentView.frame.size.height - 50);
    
    self.titleLable.frame = CGRectMake(0, self.contentView.frame.size.height - 50, self.contentView.frame.size.width, 50);
}

- (void)setTwoModel:(TwoModel *)twoModel {
    _twoModel = twoModel;
    
    [self.imageViewModel sd_setImageWithURL:[NSURL URLWithString:twoModel.imagesModel.large]];
    self.titleLable.text = twoModel.title;
    
}



@end
